#ifndef _AnalogSubcircuit_

   #define _AnalogSubcircuit_

   #include "ExPrim.h"


   typedef struct
   {
      float is, bf, nf, ise, ne, br, nr, isc, nc, rb, re, rc, cje, vje, mje, cjc, vjc, mjc, fc, tf, xtf, vtf, itf, tr, eg, xti, xtb, vbe0, vbc0, iter0;
   } stParBJT;

   typedef struct
   {
      double   vbe, vbc;
      float    yc, yb, ye, vkf, vkr, vke, vkc, is, ise, isc, bfx, brx, vje, vjc, cje, cjc, cjev, cjcv, tfv;
      icap     be_cap, bc_cap;
      idp      dbe, dbc, dbes, dbcs;
      int      ibase, iemit, icoll, coll, base, emit,
               iPolarity;
      stParBJT objParameters;
   } stBJT;

   typedef struct
   {
      float fCapacitance;
      icap  stState;
      int   iPortA,
            iPortB;
   } stCapacitor;


   typedef struct
   {
      float  is,
             n,
             rs,
             bv,
             ibv,
             cjo,
             vj,
             m,
             fc,
             tt,
             eg,
             xti,
             vac0,
             iter0;
   } stParDiode;


   typedef struct
   {
      double     vac;
      float      vkn,
                 vkb,
                 is,
                 vj,
                 cj,
                 cjv,
                 ys;
      icap       ac_cap;
      idp        dn;
      int        ianode,
                 iAnode,
                 iCathode;
      irdp       db;
      stParDiode objParameters;
   } stDiode;


   typedef struct
   {
      float fInductance;
      iind  stState;
      int   iPortA,
            iPortB;
   } stInductor;


   typedef struct
   {
      float vto, beta, lambda, rg, rd, rs, is, cgd, cgs, pb, fc, vtotc, betatc, vgs0, vgd0, iter0;
   } stParJFET;

   typedef struct
   {
      double    vds, vgs, vgd;
      float     yd, ys, yg, vk, vto, beta, is, pb, cgd, cgs, cgsv, cgdv;
      icap      gs_cap, gd_cap;
      idp       dgd, dgs;
      ifp       fet;
      int       idrn, isrc, igate, drn, src, gate, iPolarity;
      stParJFET objParameters;
   } stJFET;


   typedef struct
   {
      float vto, wlr, kp, lambda, rg, rd, rs, rb, is, cgd, cgs, cbd, cbs, cgb, pb, fc, vgs0, iter0;
   } stParMOSFET;

   typedef struct
   {
      double      vds, vgs, vgd, vbs, vbd;
      float       yd, ys, yg, yb, vk, vto, beta, is, pb, cbd, cbs, cbdv, cbsv;
      icap        gs_cap, gd_cap, bd_cap, bs_cap, gb_cap;
      idp         dbd, dbs;
      ifp         fet;
      int         idrn, isrc, igate, ibulk, drn, src, gate, bulk, iPolarity;
      stParMOSFET objParameters;
   } stMOSFET;


   typedef struct
   {
      float fAdmittance;
      int   iPortA,
            iPortB;
   } stResistor;


   void BJT_BuildAC                 (stBJT* pobjBJT, float fOmega);
   void BJT_BuildDC                 (stBJT* pobjBJT, float fSimTime, WORD wMode);
   void BJT_ErrorCheck              (stBJT* pobjBJT, double* pdVoltError);
   int  BJT_InitIntNodes            (stBJT* pobjBJT, int iCollector, int iBase, int iEmitter, int iInternalNode);
   void BJT_InitSim                 (int iInitLCMode, stBJT* pobjBJT, int iPolarity);
   void BJT_SetDefaultParameters    (stBJT* pobjBJT);
   void Capacitor_BuildAC           (stCapacitor* pobjCapacitor, float fOmega);
   void Capacitor_BuildDC           (stCapacitor* pobjCapacitor, float fSimTime, WORD wMode);
   void Capacitor_InitSim           (int iPortA, int iPortB, float fCapacitance, float fV0, int iInitLCMode, stCapacitor* pobjCapacitor);
   void Diode_BuildAC               (stDiode* pobjDiode, float fOmega);
   void Diode_BuildDC               (stDiode* pobjDiode, float fSimTime, WORD wMode);
   void Diode_ErrorCheck            (stDiode* pobjDiode, double* pdVoltError);
   int  Diode_InitIntNodes          (stDiode* pobjDiode, int iAnode, int iInternalAnode);
   void Diode_InitSim               (int iAnode, int iCathode, int iInitLCMode, stDiode* pobjDiode);
   void Diode_SetDefaultParameters  (stDiode* pobjDiode);
   void Inductor_BuildAC            (stInductor* pobjInductor, float fOmega);
   void Inductor_BuildDC            (stInductor* pobjInductor, float fSimTime, WORD wMode);
   void Inductor_InitSim            (int iPortA, int iPortB, float fInductance, float fI0, int iInitLCMode, stInductor* pobjInductor);
   void JFET_BuildAC                (stJFET* pobjJFET, float fOmega);
   void JFET_BuildDC                (stJFET* pobjJFET, float fSimTime, WORD wMode);
   void JFET_ErrorCheck             (stJFET* pobjJFET, double* pdVoltError);
   int  JFET_InitIntNodes           (stJFET* pobjJFET, int iDrain, int iGate, int iSource, int iInternalNode);
   void JFET_InitSim                (int iInitLCMode, stJFET* pobjJFET, int iPolarity);
   void JFET_SetDefaultParameters   (stJFET* pobjJFET);
   void MOSFET_BuildAC              (stMOSFET* pobjMOSFET, float fOmega);
   void MOSFET_BuildDC              (stMOSFET* pobjMOSFET, float fSimTime, WORD wMode);
   void MOSFET_ErrorCheck           (stMOSFET* pobjMOSFET, double* pdVoltError);
   int  MOSFET_InitIntNodes         (stMOSFET* pobjMOSFET, int iInternalNode);
   void MOSFET_InitSim              (int iDrain, int iGate, int iSource, int iBulk, int iInitLCMode, stMOSFET* pobjMOSFET, int iPolarity);
   void MOSFET_SetDefaultParameters (stMOSFET* pobjMOSFET);
   void Resistor_BuildAC            (stResistor* pobjResistor);
   void Resistor_BuildDC            (stResistor* pobjResistor);
   void Resistor_InitSim            (int iPortA, int iPortB, float fResistance, stResistor* pobjResistor);
   void Resistor_TestAdmit          (float fResistance, float* pfMinAdmit, float* pfMaxAdmit);

#endif
